#!/bin/bash

NOARGS=65
NOTFOUND=66
NOTGZIP=67

if [ $# -eq 0 ]  # $#是当前参数数目
then 
  echo "Usage: 'basename $0' filename"
  exit $NOARGS
fi

filename=$1 # $1是第一个参数

if [ ! -f "$filename" ]
then
  echo "filename not found!"
  exit $NOTFOUND
fi

if [ ${filename##*.} != "gz" ] # 在变量替换中使用中括号结构
then
  echo "File $1 is not a gzipped file"
  exit $NOTGZIP
fi


zcat $1 | more

exit $?  
